import request from '@/axios'
import type { CurdData } from './types'

export const getFieldEnumApi = (params: any) => {
  return request.get({ url: '/admin/customerContact/fieldEnum', params })
}

export const getListApi = (params: any) => {
  return request.get({ url: '/admin/customerContact', params })
}

export const saveApi = (data: Partial<CurdData>): Promise<IResponse> => {
  if (data.id) {
    return request.put({ url: '/admin/customerContact', data })
  } else {
    return request.post({ url: '/admin/customerContact', data })
  }
}

export const getDetApi = (id: string): Promise<IResponse<CurdData>> => {
  return request.get({ url: '/admin/customerContact/' + id, params: { id } })
}

export const delListApi = (ids: string): Promise<IResponse> => {
  return request.delete({ url: '/admin/customerContact', data: { ids } })
}
